home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / wasm223.zip / SERIAL2.ASM < prev    next >
Assembly Source File  |  1993-05-04  |  2KB  |  68 lines

  1. ;**********************************;
  2. ; WASM Serial I/O, Word Transfer   ;
  3. ; By Eric Tauck                    ;
  4. ;                                  ;
  5. ; Defines:                         ;
  6. ;                                  ;
  7. ;   ComGetW  input a word of data  ;
  8. ;   ComPutW  output a word of data ;
  9. ;                                  ;
  10. ; Requires:                        ;
  11. ;                                  ;
  12. ;   SERIAL1.ASM                    ;
  13. ;**********************************;
  14.  
  15.         jmps    _serial2_end
  16.  
  17. ;========================================
  18. ; Input a word.
  19. ;
  20. ; In: BX= record address.
  21. ;
  22. ; Out: AX= word; CY= set if unavailable.
  23.  
  24. ComGetW PROC    NEAR
  25.         push    di
  26.         mov     di, bx
  27.         call    ComByt          ;get bytes
  28.         cmp     ax, 2           ;check if at least two bytes
  29.         jb      _cminw1         ;jump if not
  30.         mov     bx, di
  31.         call    ComGet          ;get byte
  32.         push    ax
  33.         mov     bx, di
  34.         call    ComGet          ;get byte
  35.         pop     dx
  36.         mov     ah, dl          ;return high byte
  37.  
  38. ;--- finished, successful
  39.  
  40.         pop     di
  41.         clc
  42.         ret
  43.  
  44. ;--- bytes not available
  45.  
  46. _cminw1 pop     di
  47.         stc
  48.         ret
  49.         ENDP
  50.  
  51. ;========================================
  52. ; Output a word.
  53. ;
  54. ; In: BX= record address; AX= word.
  55.  
  56. ComPutW PROC    NEAR
  57.         push    ax
  58.         push    bx
  59.         mov     al, ah
  60.         call    ComPut  ;send high byte
  61.         pop     bx
  62.         pop     ax
  63.         call    ComPut  ;send low byte
  64.         ret
  65.         ENDP
  66.  
  67. _serial2_end
  68.